﻿/*Copyright (C) 2010-2012 RAAFCOM B.V. All rights reserved.

This file is part of Velsto and may be used under the terms of:
The GNU General Public License version 3 or higher, as published by
the Free Software Foundation.

This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.*/
/* 
* Application  : Velsto
* Class        : FormSingeleresults
* 28/08/2010-  : M.A.van Ravesteijn (Raafcom)
*   13/01/2012   Initial version v1.0
* 29/08/2012   : M.A.van Ravesteijn (Raafcom)
 *               v1.2 added Layername
* 
* Class to disply results of Single run simulation*/
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace Velsto
{
    public partial class FormSingleresults : Form
    {
        private SingleresultsDataTable sireDt;
        private SimulationEntity se;
        
        public FormSingleresults(SimulationEntity se2, ArrayList alVtypes )
        {
            se = new SimulationEntity(se2);
            
            sireDt = new SingleresultsDataTable();
            InitializeComponent();
            this.Text = "Single Point Results";
            this.singleXTextBox.Text = (se.SingleFound.X/10.0).ToString();
            this.singleYTextBox.Text = (se.SingleFound.Y/10.0).ToString();
            setupsireDgv();
            se = sireDt.fillSingleresultsDataTable(se,alVtypes);
            if (se.ErrorMessage != null)
            {
                MessageBox.Show(this, se.ErrorMessage, "**Error**",
                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }

        public FormSingleresults()
        {
            InitializeComponent();
        }

        private void setupsireDgv()
        {
            sireDgv.DataSource = sireDt;
            sireDgv.RowHeadersVisible = false;
            sireDgv.AllowUserToAddRows = false;
            sireDgv.Columns[0].Width = 80;
            sireDgv.Columns[0].ReadOnly = true;
            sireDgv.Columns[0].HeaderText = "";
            sireDgv.Columns[1].Width = 60;
            sireDgv.Columns[1].ReadOnly = true;
            sireDgv.Columns[1].HeaderText = "Twt\r\n(ms)";
            sireDgv.Columns[2].Width = 45;
            sireDgv.Columns[2].ReadOnly = true;
            sireDgv.Columns[2].HeaderText = "\u03c3Twt\r\n(ms)";
            sireDgv.Columns[3].Width = 100;
            sireDgv.Columns[3].ReadOnly = true;
            sireDgv.Columns[3].HeaderText = "Vel model";
            sireDgv.Columns[4].Width = 60;
            sireDgv.Columns[4].ReadOnly = true;
            sireDgv.Columns[4].HeaderText = "V(m/s) F(m/s)";
            sireDgv.Columns[5].Width = 60;
            sireDgv.Columns[5].ReadOnly = true;
            sireDgv.Columns[5].HeaderText = "\u03c3V(m/s) \u03c3F(m/s)";
            sireDgv.Columns[6].Width = 45;
            sireDgv.Columns[6].ReadOnly = true;
            sireDgv.Columns[6].HeaderText = "K(1/s) G(m)";
            sireDgv.Columns[7].Width = 45;
            sireDgv.Columns[7].ReadOnly = true;
            sireDgv.Columns[7].HeaderText = "DepVel\r\n(%)";
            sireDgv.Columns[8].Width = 45;
            sireDgv.Columns[8].ReadOnly = true;
            sireDgv.Columns[8].HeaderText = "DepV0k\r\n(%)";

            sireDgv.Columns[7].Visible = false;
            sireDgv.Columns[8].Visible = false;

            sireDgv.Columns[9].Width = 60;
            sireDgv.Columns[9].ReadOnly = true;
            sireDgv.Columns[9].HeaderText = "Aver Depth\r\n(m)";
            sireDgv.Columns[10].Width = 60;
            sireDgv.Columns[10].ReadOnly = true;
            sireDgv.Columns[10].HeaderText = "Std. Dev\r\n(m)";
        }

        private void closeButton_Click(object sender, EventArgs e)
        {
            this.Close(); 
        }
    }
}
